<?php

namespace App\Listeners;

use App\Events\PostSaved;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Log;

/**
 * 3. 定义监听器类
 * Class SaveDataToCache
 * @package App\Listeners
 */
class SaveDataToCache //implements ShouldQueue
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  PostSaved  $event
     * @return void
     */
    //$event不一定要在
    public function handle($event)
    {
        Log::info('这是异步的,牛逼啊');
        //这个必须是在事件类里面有声明,否则报错
        //$post = $event->check;
        print '事前事后';
        Log::info('访问了数组检测类');
    }
}
